<?php

class SF_Autocoupon_ViewController extends Mage_Core_Controller_Front_Action 
{ 
    public function indexAction(){
        $events_code= $this->getRequest()->getParam("code");
        if(!$events_code){
            $this->_redirect('/');
            return;
        }else{
            $this->loadLayout();
            $this->getEventsHeader($events_code);
            // $title = ucwords(str_replace("_"," ",$events_code));
            // $this->getLayout()->getBlock('head')->setTitle($this->__($title));
            $this->renderLayout();
        }
    }

    public function getEventsHeader($title){ //模板页面显示title
        $this_store = Mage::app()->getStore()->getStoreId();
        if($title == 'aug_doogee'){
            if($this_store == 2) {
                $title = 'Анонс новой модели смратфона T5 от бренда Doogee на Rumall.com';
                $this->getLayout()->getBlock('head')->setKeywords($this->__('Doogee T5, предварительной покупке, Супер предложение,Скидка 1300руб, Купона, Rumall.com'));
            }else    {
                $title = 'Doogee T5 World Premiere Pre-sale on Rumall!';
                $this->getLayout()->getBlock('head')->setKeywords($this->__('Doogee T5, Pre-sale, Hot Sale, Super Price , $20 OFF, Coupon, Rumall.com')); 
            }
        }else if($title == 'automobiles_motorcycles'){
            $title = 'Дешевле только даром на Rumall.com';
        }else{
            $title = ucwords(str_replace("_"," ",$title));
        }
        $this->getLayout()->getBlock('head')->setTitle($this->__($title));
    }
}
